dir
ディレクトリクラスのインスタンスを返します
dir()
関数は、ディレクトリクラスのインスタンスを返します。この関数は、以下を含むディレクトリの読み取りに使用されます。
使用dir()函数:
<?php $ d = dir ( getcwd ( ) ) ; エコー「ハンドル:」 。 $ d- >ハンドル。 "<br>" ; エコー「パス:」 。 $ d- > path 。 "<br>" ; while ( ( $ file = $ d- > read ( ) ) !== false ) { エコー「ファイル名:」 。 $ファイル。 "<br>" ; } $ d- > close ( ) ; ?>
结果:
ハンドル:リソースID#2 パス: /etc /php ファイル名: 。 ファイル名: .. ファイル名:ajax.gif ファイル名:books.xml ファイル名:cdcatalog.xml ファイル名:cd_catalog.xml ファイル名:index.asp ファイル名:demo_array.asp ファイル名:demo_array.htm ... ... ...
dir (ディレクトリ、コンテキスト) ;
パラメーター | 説明する |
---|---|
ディレクトリ | 必須。開くディレクトリを指定します。 |
コンテクスト | オプション。 |